#include <iostream>

#include "calculator.h"

using namespace std;

int main() {
	double x = 0.0;
	double y = 0.0;
	double result = 0.0;
	char oper = '+';

    cout << "Calca - Simple TUI calculator." << endl << endl;
    cout << "Please enter the operation to perform. Format: a+b | a-b | a*b | a/b"
         << endl;

    Calculator c;
    while (true) {
		cout << ">>> ";
		cin.clear();
        cin >> x >> oper >> y;
		
        if (oper == '/' && y == 0) {
            cout << "Division by 0 exception" << endl;
            continue;
        } else {
            result = c.calculate(x, oper, y);
        }
        cout << result << endl;
    }

    return 0;
}
